//
//  NodataView.m
//  yiluServe
//
//  Created by 杨阳 on 2018/2/5.
//  Copyright © 2018年 jian wang. All rights reserved.
//

#import "NodataView.h"

@interface NodataView ()

@property (nonatomic,strong) UIImageView * imageView;

@property (nonatomic,strong) UILabel * titleLabel;

@property (nonatomic,strong) UILabel * subTitleLabel;


@end

@implementation NodataView

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self == [super initWithFrame:frame]) {
        
        __weak typeof (self) weakSelf = self;
        self.backgroundColor = [UIColor whiteColor];
        self.imageView = [[UIImageView alloc]init];
        self.imageView.image = [UIImage imageNamed:@"nothingbg_logo"];
        [self addSubview:self.imageView];
        CGSize imageSize;
        if (iPhoneX) {
            imageSize = CGSizeMake(80, 80);
        }else{
            imageSize = CGSizeMake(80*PROPORTION_WIDTH_IPHONE6, 80*PROPORTION_HEIGHT_IPHONE6);
        }
        [self.imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(weakSelf.mas_centerX);
            make.centerY.equalTo(weakSelf.mas_centerY).offset(-30);
            make.size.mas_equalTo(imageSize);
        }];
        
        self.titleLabel = [[UILabel alloc]init];
        self.titleLabel.textColor = RGBColor(214, 215, 219);
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:16];
        [self addSubview:self.titleLabel];
        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf.imageView.mas_bottom).offset(15);
            make.height.mas_equalTo(22);
            make.centerX.equalTo(weakSelf.imageView.mas_centerX);
        }];
        
        self.subTitleLabel  = [[UILabel alloc]init];
        self.subTitleLabel.textColor = RGBColor(214, 215, 219);
        self.subTitleLabel.textAlignment = NSTextAlignmentCenter;
        self.subTitleLabel.font = [UIFont systemFontOfSize:16];
        [self addSubview:self.subTitleLabel];
        [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf.titleLabel.mas_bottom).offset(0);
            make.height.mas_equalTo(22);
            make.centerX.equalTo(weakSelf.imageView.mas_centerX);
        }];
        
    }
    return self;
}

-(void)setCenterImage:(UIImage *)centerImage{
    
    _imageView.image = centerImage;
    _centerImage = centerImage;
    
}
-(UIImage *)centerImage{
    return _centerImage;
}

-(void)setTitleStr:(NSString *)titleStr{
    
    _titleLabel.text = titleStr;
    _titleStr = titleStr;
    
}
-(NSString *)titleStr{
    return _titleStr;
}

-(void)setSubTitleStr:(NSString *)subTitleStr{
    _subTitleLabel.text = subTitleStr;
    _subTitleStr = subTitleStr;
}
-(NSString *)subTitleStr{
    return _subTitleStr;
}


@end
